import React, { PureComponent } from 'react'
/* 这里使用PureComponent 当外部数据和自身数据不变时，不会重新渲染 */
export default class Son extends PureComponent {
    state = {
        money : 1999
    }
  render() {
    console.log('Son render');
    
    let { money } = this.state
    let { count } = this.props
    return (
      <div>
        <h3>Son</h3>
        <p>Son money : { money}</p>
        <p>App Count: {count}</p>
        <p><button onClick={() => this.setState({
            money: money += 100
        })}>money ++</button></p>
        <p>
        <button onClick={() => this.setState({
            money: money = 1888
        })}>money秒杀价1888</button>
        </p>
      </div>
    )
  }
}
